<?php
defined('_JEXEC') or die('Restricted access');
$url = clone(JURI::getInstance());
?>
<?php echo '<?xml version="1.0" encoding="utf-8"?' .'>'; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->language; ?>" lang="<?php echo $this->language; ?>" dir="<?php echo $this->direction; ?>" >
<head>
<jdoc:include type="head" />
<?php JHTML::_('behavior.mootools'); ?>
<?php 
include('scripts/php/template_config.php');
include('scripts/php/user.php');
include('scripts/php/tab.php');

?> 
<?php
$templatewidth = intval($this->params->get('templatewidth'));
// #mainbox width
if ($tp_left >= 1) {
		$mainbox = $templatewidth - 240; 
	} else {
		$mainbox = $templatewidth - 20;
	}

// #mainbods width
if (($tp_right + $tp_user31 + $tp_user32 + $tp_user33 + $tp_user34 + $tp_user6 + $tp_user7 + $tp_advert3) >= 1) {	
	$mainbods = $mainbox - 250;
	} else {
	$mainbods = $mainbox ;
	}

//user6 user7 width

if ($tp_user6 >= 1 ) $u6width = 1; 
	else $u6width = 0; 
if ($tp_user7 >= 1 ) $u7width = 1; 
	else $u7width = 0; 
	
if (($u6width + $u7width) == 1) {
	$u67width = 340;
	$u67extmargin = 0;}
elseif (($u6width + $u7width) == 2) {
	$u67width = 170;
	$u67extmargin = 10; }

// user9 user10 width

if ($tp_user9 >= 1 ) $u9width = 1; 
	else $u9width = 0; 
if ($tp_user10 >= 1 ) $u10width = 1; 
	else $u10width = 0; 
	
if (($u9width + $u10width) == 1) {
	$u910width = $mainbods;
	$u910extmargin = 0;}
elseif (($u9width + $u10width) == 2) {
	$u910width = $mainbods/2;
	$u910extmargin = 10; }
	
// user1 user2 width

if ($tp_user1 >= 1 ) $u1width = 1; 
	else $u1width = 0; 
if ($tp_user2 >= 1 ) $u2width = 1; 
	else $u2width = 0; 
	
if (($u1width + $u2width) == 1) {
	$u12width = $mainbods;
	$u12extmargin = 0;}
elseif (($u1width + $u2width) == 2) {
	$u12width = $mainbods/2;
	$u12extmargin = 10; }

//user35 user36 width

if ($tp_user35 >= 1 ) $u35width = 1; 
	else $u35width = 0; 
if ($tp_user36 >= 1 ) $u36width = 1; 
	else $u36width = 0; 
	
if (($u35width + $u36width) == 1) {
	$u3536width = 340;
	$u3536extmargin = 0;}
elseif (($u35width + $u36width) == 2) {
	$u3536width = 170;
	$u3536extmargin = 10; }
	
// 4 bottom mod width calculation 
if (($tp_user35 + $tp_user36) >= 1) {
$botmod_section_width = $templatewidth - 370; }
else {
	$botmod_section_width = $templatewidth -20;}

if ($tp_user41 >= 1 ) $botmod_1 = 1; 
	else $botmod_1 = 0; 
if ($tp_user42 >= 1 ) $botmod_2 = 1; 
	else $botmod_2 = 0; 
if ($tp_user43 >= 1 ) $botmod_3 = 1; 
	else $botmod_3 = 0;
if ($tp_user44 >= 1 ) $botmod_4 = 1; 
	else $botmod_4 = 0;

if ($botmod_1 + $botmod_2  + $botmod_3 + $botmod_4 == 4 ) { 
	$botmodwidth = $botmod_section_width/4-2; } 
elseif ($botmod_1 + $botmod_2  + $botmod_3 + $botmod_4 == 3 ) { 
	$botmodwidth = $botmod_section_width/3; } 
elseif ($botmod_1 + $botmod_2  + $botmod_3 + $botmod_4 == 2 ) { 
	$botmodwidth = $botmod_section_width/2; } 
elseif ($botmod_1 + $botmod_2  + $botmod_3 + $botmod_4 == 1 ) { 
	$botmodwidth = $botmod_section_width;
 }
 ?>

<meta http-equiv="Content-Type" content="text/html; <?php echo _ISO; ?>" />
<link rel="stylesheet" href="templates/difrancia_magazine_plazza/css/css.gzip.php?style=<?php echo $style; ?>&amp;type=<?php echo $type; ?>&amp;size=<?php echo $size; ?>" type="text/css" />
<script type="text/javascript" src="templates/difrancia_magazine_plazza/scripts/js/mootools.js"></script>
<script type="text/javascript" src="templates/difrancia_magazine_plazza/scripts/js/js.gzip.php"></script>
</head>
<body class="bodies">
<div id="globalwrapper">
	<div id="maincpwrapper" align="center">
		<div id="pagewrapper" style="width:<?php echo $templatewidth; ?>px;">
			<div id="pageinner" style="width:<?php echo $templatewidth - 20; ?>px;">
				<div id="topspot">
					<div id="bookmarkmod">
						<jdoc:include type="modules" name="inset" style="raw" />
					</div>
					<div id="topspotmenu">
						<jdoc:include type="modules" name="user3" style="raw" />
					</div>
				</div>
						
				<div id="topsectwrapper">
					<div>
						<div id="logos">
							<a href="<?php echo $this->baseurl ?>">
							<img src="templates/difrancia_magazine_plazza/images/spacer.gif" alt="Joomla Template Club" width="420" height="74" border="0" />
							</a>
							<?php if ($tp_user4) { ?>
							<div id="searchbox">
								<div id="searchbox_inner"><jdoc:include type="modules" name="user4" style="xhtml" /></div>
							</div>
							<?php } ?>
						</div>
					</div>
					<div style="clear:both"></div>
					<div class="colorful"></div>				
				</div> <!-- end topsectwrapper -->
				<div style="clear:both"></div>
				<?php if($tp_user8 ) { ?>
				<div id="tpmenu">
					<jdoc:include type="modules" name="user8" style="xhtml" />
				</div>
				<?php }?>
				<div id="content_section">
					<div id="mainbox" style="width:<?php echo $mainbox; ?>px;">
						<div id="mainbods" style="width:<?php echo $mainbods; ?>px;">
							<?php echo tptabstatic1($tab1a_name, $tab2a_name, $tab3a_name, $tab4a_name,$tp_user11, $tp_user12, $tp_user13, $tp_user14); ?>
							<?php echo tptabstatic2($tab1b_name, $tab2b_name, $tab3b_name, $tab4b_name,$tp_user21, $tp_user22, $tp_user23, $tp_user24); ?>
								<jdoc:include type="modules" name="advert1" style="xhtml" />
								
							<?php if($tp_user9 || $tp_user10 ) { ?>	
							<div id="u910">
								<div id="u9box" style="width:<?php echo $u910width; ?>px;">
									<jdoc:include type="modules" name="user9" style="xhtml" />
								</div>
								<div id="u10box" style="width:<?php echo $u910width ?>px;"  <?php if ($tp_user9 >= 1 ) echo "class=\"vertsep\""; ?>>
									<div id="u10boxinner" style="width:<?php echo $u910width - $u910extmargin; ?>px;">
									<jdoc:include type="modules" name="user10" style="xhtml" />
									</div>
								</div>
								<div class="clearfix"></div>
							</div>
							<?php } ?>
							
							
							<div id="mainbodsbody">
							<jdoc:include type="component" /><br />

							<jdoc:include type="modules" name="advert2" style="xhtml" />
							</div>
							
							<?php if($tp_user1 || $tp_user2 ) { ?>	
							<div id="u12">
								<div id="u1box" style="width:<?php echo $u12width; ?>px;">
									<jdoc:include type="modules" name="user1" style="xhtml" />
								</div>
								<div id="u2box" style="width:<?php echo $u12width ?>px;"  <?php if ($tp_user1 >= 1 ) echo "class=\"vertsep\""; ?>>
									<div id="u2boxinner" style="width:<?php echo $u12width - $u12extmargin; ?>px;">
									<jdoc:include type="modules" name="user2" style="xhtml" />
									</div>
								</div>
								<div class="clearfix"></div>
							</div>
							<?php } ?>
							
						</div>
						<div id="rightbods">
							<?php echo tptabstatic3($tab1c_name, $tab2c_name, $tab3c_name, $tab4c_name,$tp_user31, $tp_user32, $tp_user33, $tp_user34); ?>
							<jdoc:include type="modules" name="right" style="xhtml" />
							
							
							<?php if($tp_user6 || $tp_user7 ) { ?>	
							<div id="u67">
								<div id="u6box" style="width:<?php echo $u67width; ?>px;">
									<jdoc:include type="modules" name="user6" style="xhtml" />
								</div>
								<div id="u7box" style="width:<?php echo $u67width; ?>px;" <?php if ($tp_user6 >= 1 ) echo "class=\"vertsep\""; ?>>
									<div id="u7boxinner" style="width:<?php echo $u67width - $u67extmargin; ?>px;">
										<jdoc:include type="modules" name="user7" style="xhtml" />
									</div>
								</div>
								<div class="clearfix"></div>
							</div>
							<?php } ?>
							<jdoc:include type="modules" name="advert3" style="xhtml" />
							
						</div>
					</div>
					<div id="leftbox">
						<jdoc:include type="modules" name="left" style="xhtml" />
					</div>
					

				
				</div> <!-- end content section -->
				<div class="clearfix"></div>
				<?php if($tp_user41 || $tp_user42 ||$tp_user43 || $tp_user44 || $tp_user35 || $tp_user36) { ?>
				<div class="horizsep" style="width:<?php echo $templatewidth - 20; ?>px;">				
				</div><?php } ?>	
				<div id="contentbottomsection">
					<?php if($tp_user41 || $tp_user42 ||$tp_user43 || $tp_user44) { ?>
					<div id="cbs1">
						<div id="botmodsection" style="width:<?php echo $botmod_section_width ; ?>px;">
							<div id="botmodsection_inner">
								<div class="botmodsection_inner_c">
									<?php if ($tp_user41) { ?>
									<div id="botmodsection_1"  style="width:<?php echo $botmodwidth; ?>px;" >
										<div id="botmodsection_1inner" >
											<jdoc:include type="modules" name="user41" style="xhtml" />
										</div>
									</div>
									<?php } ?>								
									<?php if ($tp_user42) { ?>
									<div id="botmodsection_2"  style="width:<?php echo $botmodwidth; ?>px;" >
										<div id="botmodsection_2inner" >
											<jdoc:include type="modules" name="user42" style="xhtml" />
										</div>
									</div>
									<?php } ?>								
									<?php if ($tp_user43) { ?>
									<div id="botmodsection_3"  style="width:<?php echo $botmodwidth; ?>px;" >
										<div id="botmodsection_3inner" >
										<jdoc:include type="modules" name="user43" style="xhtml" />
										</div>
									</div>
									<?php } ?>								
									<?php if ($tp_user44) { ?>
									<div id="botmodsection_4" style="width:<?php echo $botmodwidth; ?>px;">
										<div id="botmodsection_4inner" >
										<jdoc:include type="modules" name="user44" style="xhtml" />
										</div>
									</div>
									<?php } ?>
									<div class="clearfix"></div>
								</div>
							</div>				
						</div>					
					</div> <!-- end cbs 1 -->
					<?php } ?>	
					<?php if($tp_user35 || $tp_user36 ) { ?>	
					<div id="cbs2">
						<div id="u3536">
							<div id="u35box" style="width:<?php echo $u3536width; ?>px;"> 
									<jdoc:include type="modules" name="user35" style="xhtml" />
							</div>
							<div id="u36box" style="width:<?php echo $u3536width; ?>px;" <?php if ($tp_user35 >= 1 ) echo "class=\"vertsep\""; ?>>
								<div id="u36boxinner" style="width:<?php echo $u3536width - $u3536extmargin; ?>px;">
									<jdoc:include type="modules" name="user36" style="xhtml" />
								</div>
							</div>
							<div class="clearfix"></div>
						</div>
					</div> <!-- end cbs 2 -->
					<?php } ?>
				</div>
				<div class="clearfix"></div>
				<div class="horizsep" style="width:<?php echo $templatewidth - 20; ?>px;">						
				</div>
				<div class="clearfix"></div>
				
				<div id="footer_wrapper">
					<div id="footer_right">
						<jdoc:include type="modules" name="bottom" style="xhtml" />			
					</div>
					<div style="clear:both; line-height:1px;">&nbsp;</div>
				</div>	
					
			</div><!-- end #pageinner -->
			<div class="clearfix"></div>						
		</div> <!-- end #pagewarpper -->	
	</div> <!-- end #maincpwrapper -->
</div>
</body>
</html>